package com.luguangtao.controller;

import com.luguangtao.api.InsuranceApi;
import com.luguangtao.bean.Insurance;
import com.luguangtao.config.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @类名: com.luguangtao.controller
 * @作者: lgt
 * @创建时间: 2019-12-16 09:28
 * @描述:
 **/
@RestController
@CrossOrigin
public class InsuranceController {
    @Autowired
    InsuranceApi insuranceApi;

    //列表+分页+模糊
    @RequestMapping("lists")
    public Page<Insurance> lists(Integer pageNum, Double am1, Double am2){
        if(am1!=null && am1!=0){

            Page<Insurance> lists1 = insuranceApi.lists(pageNum, am1, am2);
            return lists1;
        }else{
            Page<Insurance> lists = insuranceApi.lists(pageNum);
            return lists;
        }
    }
}
